/**
 * @license Copyright 2016 Google Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 */

/**
 * Typing externs file for the result of an audit.
 * @externs
 */

/**
 * @struct
 * @record
 */
function AuditResult() {}

/**
 * The only required value in an audit result. Used as the `score` if no score
 * is provided.
 * @type {(boolean|number)}
 */
AuditResult.prototype.rawValue;

/** @type {(boolean|number|undefined)} */
AuditResult.prototype.score;

/** @type {(string|undefined)} */
AuditResult.prototype.displayValue;

/**
 * Optional error string for helping the user figure out why they failed here.
 * @type {(string|undefined)}
 */
AuditResult.prototype.debugString;

/** @type {(boolean|number|string|undefined|null)} */
AuditResult.prototype.optimalValue;

/** @type {(AuditExtendedInfo|undefined|null)} */
AuditResult.prototype.extendedInfo;

/** @type {(Object|undefined)} */
AuditResult.prototype.details;

/**
 * The full audit result as generated by Audit.generateAuditResult from an
 * AuditResult. See Config.assertValidAudit for audit required meta fields.
 * @struct
 * @record
 */
function AuditFullResult() {}

/** @type {(boolean|number)} */
AuditFullResult.prototype.score;

/** @type {string} */
AuditFullResult.prototype.scoringMode;

/** @type {string} */
AuditFullResult.prototype.displayValue;

/** @type {(boolean|number)} */
AuditFullResult.prototype.rawValue;

/**
 * Optional property indicating that some error occurred either in generating an
 * artifact required by this audit or within the audit itself and so the audit
 * is un-scoreable. Audits can create an error by simply throwing an exception.
 * @type {(boolean|undefined)}
 */
AuditFullResult.prototype.error;

/** @type {(string|undefined)} */
AuditFullResult.prototype.debugString;

/** @type {(boolean|number|string|undefined|null)} */
AuditFullResult.prototype.optimalValue;

/** @type {(AuditExtendedInfo|undefined|null)} */
AuditFullResult.prototype.extendedInfo;

/** @type {string} */
AuditFullResult.prototype.name;

/** @type {string} */
AuditFullResult.prototype.category;

/** @type {string} */
AuditFullResult.prototype.description;

/** @type {string} */
AuditFullResult.prototype.helpText;

/** @type {(Object|undefined)} */
AuditFullResult.prototype.details;

/**
 * @struct
 * @record
 */
function AuditExtendedInfo() {}

/** @type {(Object|Array<UserTimingsExtendedInfo>|FirstMeaningfulPaintExtendedInfo|undefined)} */
AuditExtendedInfo.prototype.value;

/**
 * @struct
 * @record
 */
function UserTimingsExtendedInfo() {}

/** @type {!string} */
UserTimingsExtendedInfo.prototype.name;

/** @type {!boolean} */
UserTimingsExtendedInfo.prototype.isMark;

/** @type {!Object} */
UserTimingsExtendedInfo.prototype.args;

/** @type {!number} */
UserTimingsExtendedInfo.prototype.startTime;

/** @type {(number|undefined)} */
UserTimingsExtendedInfo.prototype.endTime;

/** @type {(number|undefined)} */
UserTimingsExtendedInfo.prototype.duration;

/**
 * @struct
 * @record
 */
function FirstMeaningfulPaintExtendedInfo() {}

/** @type {!FirstMeaningfulPaintTimings} */
FirstMeaningfulPaintExtendedInfo.prototype.timings;

/**
 * @struct
 * @record
 */
function FirstMeaningfulPaintTimings() {}

/** @type {number} */
FirstMeaningfulPaintTimings.prototype.fCP;

/** @type {number} */
FirstMeaningfulPaintTimings.prototype.fMP;

/** @type {number} */
FirstMeaningfulPaintTimings.prototype.navStart;
